package com.itheima.day06.ARRAY;

import java.util.Arrays;

public class Arraytsts {
    public static void main(String[] args) {
        TUDENTS[] students = {
                new TUDENTS("小王", 180, 18),
                new TUDENTS("小张", 170, 29),
                new TUDENTS("小李", 165, 17),
                new TUDENTS("小赵", 160, 21)
        };
        //lambda表达式
//        Arrays.sort(students, (TUDENTS o1, TUDENTS o2)-> {
//                return o1.getAge()-o2.getAge();}
//                 );
        //lambda表达式缺省规则继续简化
        Arrays.sort(students, (o1,o2)->o1.getAge()-o2.getAge()
        );
        for (int i = 0; i < students.length; i++) {
            System.out.println(students[i]);
        }

    }


}
